/**
 * @(#)TaskManagerInstance.java        1.0 2/21/12
 * 
 * Copyright (c) 2012 public static droid main
 * Georgia Institute of Technology, Atlanta, GA
 * All rights reserved.
 */

package edu.gatech.oad.publicstaticdroidmain.taskmanager.ui;

import android.app.Application;
import edu.gatech.oad.publicstaticdroidmain.taskmanager.model.TaskManager;
import edu.gatech.oad.publicstaticdroidmain.taskmanager.model.TaskManagerDBFacade;

/**
 * A singleton that holds a single instance of a TaskManager object.
 * This class contains static methods for accessing that instance.
 * The purpose of this class is to enable all Activities in the GUI
 * to access the same TaskManager instance without having to keep
 * passing it around.
 * 
 * @version 1.0 Feb 21 2012
 * @author Raheel Merali
 */
public class TaskManagerApplication extends Application {
    private static TaskManagerDBFacade TM_DB_FACADE_INSTANCE;
    
    /**
     * Sets the instance of TaskManager to the specified TaskManager.
     *
     * @param newTaskManager the new instance of TaskManager
     */
    public static void setFacade(TaskManagerDBFacade newFacade) {
	TM_DB_FACADE_INSTANCE = newFacade;
    }
    
    /**
     * Returns the current TaskManager instance.
     *
     * @return the current instance of TaskManager
     */
    public static TaskManagerDBFacade getFacade() {
	return TM_DB_FACADE_INSTANCE;
    }
}
